import request from '@/config/axios'

export interface AccountVO {
  id: number
  channelId: number
  userId: number
  openId: string
  accessToken: string
  refreshToken: string
  accessExpireIn: number
  refreshExpireIn: number
  scope: string
  userNickName: string
  userAvatarUrl: string
  userRoleType: number
  unionId: string
}

// 查询账户分页
export const getAccountPage = async (params) => {
  return await request.get({ url: `/operate/account/page`, params })
}

// 查询账户详情
export const getAccount = async (id: number) => {
  return await request.get({ url: `/operate/account/get?id=` + id })
}

// 新增账户
export const createAccount = async (data: AccountVO) => {
  return await request.post({ url: `/operate/account/create`, data })
}

// 修改账户
export const updateAccount = async (data: AccountVO) => {
  return await request.put({ url: `/operate/account/update`, data })
}

// 删除账户
export const deleteAccount = async (id: number) => {
  return await request.delete({ url: `/operate/account/delete?id=` + id })
}
